/* GUI CONVERTED from rcctmta.p (converter v1.75) Tue Apr 10 12:03:36 2001 */
/* rcctmta.p - Release Management Customer Schedules                          */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.12 $                                                         */
/*V8:ConvertMode=Maintenance                                                  */
/* REVISION: 7.3    LAST MODIFIED: 06/01/93           BY: WUG *GB46*          */
/* REVISION: 7.3    LAST MODIFIED: 11/07/94           BY: ljm *GO15*          */
/* REVISION: 7.3    LAST MODIFIED: 12/15/94           BY: rxm *GN16*          */
/* REVISION: 7.3    LAST MODIFIED: 03/04/95           BY: jxz *G0GG*          */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 02/17/00   BY: *K25J* Abhijeet Thakur    */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 06/06/00   BY: *N0CX* Jean Miller        */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown         */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.12 $    BY: Jean Miller    DATE: 03/22/01 ECO: *P008*        */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* UPDATE SPECIAL BARCODE VALUE OR LABEL TEXT FIELDS */


/* ********** Begin Translatable Strings Definitions ********* */

{mfdeclre.i} /*GUI moved to top.*/
&SCOPED-DEFINE rcctmta_p_1 " Shipping Label Special Text Fields "
/* MaxLen: Comment: */

&SCOPED-DEFINE rcctmta_p_2 " Shipping Label Special Barcode Fields "
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

/*GUI moved mfdeclre/mfdtitle.*/
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

define input parameter abs_recid as recid.

define variable ad_spcl1_desc as character format "x(24)".
define variable ad_spcl2_desc as character format "x(24)".
define variable ad_spcl3_desc as character format "x(24)".
define variable ad_spcl4_desc as character format "x(24)".
define variable ad_spcl1_text_desc as character format "x(24)".
define variable ad_spcl2_text_desc as character format "x(24)".
define variable ad_spcl3_text_desc as character format "x(24)".
define variable ad_spcl4_text_desc as character format "x(24)".

define variable barcode_value as character format "x(20)" extent 4.
define variable text_value as character format "x(20)" extent 4.
define variable addr as character.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
ad_spcl1_desc        colon 10 no-label
   barcode_value[1]     no-label
   ad_spcl2_desc        colon 10 no-label
   barcode_value[2]     no-label
   ad_spcl3_desc        colon 10 no-label
   barcode_value[3]     no-label
   ad_spcl4_desc        colon 10 no-label
   barcode_value[4]     no-label
 SKIP(.4)  /*GUI*/
with frame a width 80 attr-space side-labels
 NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = (getFrameTitle("SHIPPING_LABEL_SPECIAL_BARCODE_FLDS",50)).
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
ad_spcl1_text_desc   colon 10 no-label
   text_value[1]        no-label
   ad_spcl2_text_desc   colon 10 no-label
   text_value[2]        no-label
   ad_spcl3_text_desc   colon 10 no-label
   text_value[3]        no-label
   ad_spcl4_text_desc   colon 10 no-label
   text_value[4]        no-label
 SKIP(.4)  /*GUI*/
with frame b width 80 attr-space side-labels
 NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-b-title AS CHARACTER.
 F-b-title = (getFrameTitle("SHIPPING_LABEL_SPECIAL_TEXT_FIELDS",47)).
 RECT-FRAME-LABEL:SCREEN-VALUE in frame b = F-b-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame b =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame b + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame b =
  FRAME b:HEIGHT-PIXELS - RECT-FRAME:Y in frame b - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME b = FRAME b:WIDTH-CHARS - .5. /*GUI*/


/* SET EXTERNAL LABELS */
setFrameLabels(frame b:handle).

find abs_mstr where recid(abs_mstr) = abs_recid exclusive-lock.

/* FIRST GET AN AD_MSTR RECORD THAT DEFINES THE LABEL */
for first ad_mstr
fields(ad_addr ad_barlbl_prt ad_ref)
where ad_addr = abs_shipto
no-lock: end.

if available ad_mstr then do:

   do while ad_barlbl_prt = "" and ad_ref > "":
      addr = ad_ref.
      find ad_mstr where ad_addr = addr no-lock.
   end.

   if ad_barlbl_prt = "" then leave.

   assign
      ad_spcl1_desc        = substring(ad_barlbl_prt,25,24)
      ad_spcl2_desc        = substring(ad_barlbl_prt,50,24)
      ad_spcl3_desc        = substring(ad_barlbl_prt,75,24)
      ad_spcl4_desc        = substring(ad_barlbl_prt,100,24)
      ad_spcl1_text_desc   = substring(ad_barlbl_prt,244,24)
      ad_spcl2_text_desc   = substring(ad_barlbl_prt,268,24)
      ad_spcl3_text_desc   = substring(ad_barlbl_prt,292,24)
      ad_spcl4_text_desc   = substring(ad_barlbl_prt,316,24).

end. /* FOR FIRST AD_MSTR */

/* BAIL IF NOTHING SET UP */
if ad_spcl1_desc = ""
   and ad_spcl2_desc = ""
   and ad_spcl3_desc = ""
   and ad_spcl4_desc = ""
   and ad_spcl1_text_desc = ""
   and ad_spcl2_text_desc = ""
   and ad_spcl3_text_desc = ""
   and ad_spcl4_text_desc = ""
then
   return.

assign
   barcode_value[1]        = substring(abs_doc_data[2],1,20)
   barcode_value[2]        = substring(abs_doc_data[2],21,20)
   barcode_value[3]        = substring(abs_doc_data[2],41,20)
   barcode_value[4]        = substring(abs_doc_data[2],61,20)
   text_value[1]           = substring(abs_doc_data[2],81,20)
   text_value[2]           = substring(abs_doc_data[2],101,20)
   text_value[3]           = substring(abs_doc_data[2],121,20)
   text_value[4]           = substring(abs_doc_data[2],141,20).

if ad_spcl1_desc > ""
   or ad_spcl2_desc > ""
   or ad_spcl3_desc > ""
   or ad_spcl4_desc > ""
then do:

   display
      ad_spcl1_desc
      ad_spcl2_desc
      ad_spcl3_desc
      ad_spcl4_desc
   with frame a.

   update
      barcode_value[1]        when (ad_spcl1_desc > "")
      barcode_value[2]        when (ad_spcl2_desc > "")
      barcode_value[3]        when (ad_spcl3_desc > "")
      barcode_value[4]        when (ad_spcl4_desc > "")
   with frame a.

   hide frame a no-pause.

end.

if ad_spcl1_text_desc > ""
   or ad_spcl2_text_desc > ""
   or ad_spcl3_text_desc > ""
   or ad_spcl4_text_desc > ""
then do:

   display
      ad_spcl1_text_desc
      ad_spcl2_text_desc
      ad_spcl3_text_desc
      ad_spcl4_text_desc
   with frame b.

   update
      text_value[1]   when (ad_spcl1_text_desc > "")
      text_value[2]   when (ad_spcl2_text_desc > "")
      text_value[3]   when (ad_spcl3_text_desc > "")
      text_value[4]   when (ad_spcl4_text_desc > "")
   with frame b.

   hide frame b no-pause.

end.

abs_doc_data[2] =
   string(barcode_value[1],"x(20)")
   + string(barcode_value[2],"x(20)")
   + string(barcode_value[3],"x(20)")
   + string(barcode_value[4],"x(20)")
   + string(text_value[1],"x(20)")
   + string(text_value[2],"x(20)")
   + string(text_value[3],"x(20)")
   + string(text_value[4],"x(20)").
